package vista;

import java.util.ArrayList;
import java.util.List;

import javax.swing.table.AbstractTableModel;

import modelo.Umpire;
import modelo.DAO.UmpireDAO;

public class VentanaListaUmpireTabla extends AbstractTableModel {

	private static String[] titulos = {"Cedula", "Nombre", "Apellido", "Fecha de Nacimiento", "Juegos Arbitrados"};
	private List<Umpire> umpires;
	
	public VentanaListaUmpireTabla(List<Umpire> umpires) {
		super();
		this.umpires=umpires;
		this.fireTableDataChanged();
	}

	public int getColumnCount() {
		// TODO Auto-generated method stub
		return titulos.length;
	}

	public int getRowCount() {
		// TODO Auto-generated method stub
		return umpires.size();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Umpire umpire = umpires.get(rowIndex);
		switch (columnIndex){
			case 0: return umpire.getCedula();
			case 1: return umpire.getNombre();
			case 2: return umpire.getApellido();
			case 3: return umpire.getFechaNac();
			case 4: return umpire.getjArbitrados();
		}
		return null;
	}

	@Override
	public String getColumnName(int column) {
		return titulos[column];
	}

}
